package Operation;//操作包

import mybook.MyBook;
import mybook.MyBookList;

import java.util.Scanner;

//借阅图书类
public class Borrow implements IOperation{

    @Override
    public void work(MyBookList myBookList) {

        System.out.println("借阅图书");

        Scanner scanner = new Scanner(System.in);

        String title = scanner.nextLine();

        int count = myBookList.getCount();

        for (int i = 0; i < count; i++) {

            MyBook myBook = myBookList.getBook(i);

            if(myBook.getTitle().equals(title)) {
                myBook.setState(true);
                System.out.println("借阅成功");
                return;
            }

        }
        System.out.println("不好意思暂时没有这本书");
    }


}